//
//  WFSettingUserCell.m
//  谷居
//
//  Created by dllo on 16/6/28.
//  Copyright © 2016年 刘万方. All rights reserved.
//

#import "WFSettingUserCell.h"
#import "Masonry.h"
@implementation WFSettingUserCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}


- (void)createCell {
    _userImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_userImageView];
    [_userImageView release];
    
    _nameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_nameLabel];
    [_nameLabel release];
    
    _rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:_rightButton];;
    [_rightButton release];
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    [_userImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.size.mas_equalTo(CGSizeMake(40, 40));
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(15);
    }];
    
    _userImageView.backgroundColor = [UIColor yellowColor];
    _userImageView.layer.cornerRadius = 20;
    _userImageView.layer.masksToBounds = YES;
    _userImageView.image = [UIImage imageNamed:@"头像.jpg"];
    [_nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_userImageView.mas_right).offset(10);
        make.right.equalTo(_rightButton.mas_left).offset(-10);
        make.centerY.equalTo(self.contentView);
        make.height.mas_equalTo(20);
        
    }];
    
    _nameLabel.text = @"lucifer";
    _nameLabel.textColor = [UIColor lightTextColor];
    
    [_rightButton mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.contentView).offset(-10);
        make.centerY.equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(16, 16));
    }];
    [_rightButton setBackgroundImage:[UIImage imageNamed:@"右箭头.png"] forState:UIControlStateNormal];
    [_rightButton addTarget:self action:@selector(clickButton:) forControlEvents:UIControlEventTouchUpInside];
    
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {

}
- (void)clickButton:(UIButton *)button {
    NSLog(@"用户cell被点击");
}
@end
